<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 函数名第一个字母要大写
        function Person(uname, age, sex) {
            this.name = uname;
            this.age = age;
            this.sex = sex;
            this.sayhi = function (demo) {
                console.log(demo);
            }
        }
        // 搭配new使用
        var bigbai = new Person("大白", "3", "女");
        var smallbai = new Person("小白", "1", "男");
        smallbai.sayhi("hi");
        console.log(bigbai.name);
        console.log(smallbai.sex);
    </script>
</head>

<body>

</body>

</html>